@kjm wlan.antenna() return the value of in internal variable with the name antenna_type_selected, which is not change when you just set the value of the GPIO pin from your Python script.